package cn.szabadsag.base.controller;

import cn.szabadsag.base.service.ICodeService;
import cn.szabadsag.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 验证码表现层公共类
 *
 * @author yangcong
 * @date 2022年03月10日 18:22
 * @since v1.0
 */
@RestController
public class CodeController {

    @Autowired
    private ICodeService codeService;


    /**
     * 发送验证码
     * @return
     */
    @PostMapping("/sendCode")
    public AjaxResult sendCode(@RequestBody Map<String,String> map){

        try {
            codeService.sendCode(map);
            return AjaxResult.me();
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.me().setMessage(e.getMessage());
        }

    }





}
